#include <iostream>

#include "BinaryTree.hpp"

using namespace std;

class Solution
{
public:
    bool isSameTree(TreeNode *p, TreeNode *q)
    {
        if (p == nullptr && q == nullptr)
            return true;
        if ((p == nullptr || q == nullptr) && (!(p == nullptr && q == nullptr)))
            return false;
        if (p->val != q->val)
            return false;
        return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
    }
};

int main()
{
    TreeNode *root1 = CreatTree("[1,3,3]", "null");
    TreeNode *root2 = CreatTree("[1,2,3]", "null");
    Solution s;
    cout << s.isSameTree(root1, root2) << endl;
    return 0;
}